package com.simple.relaxed.manager.impl;

import com.simple.relaxed.manager.AbstractManager;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Agent的管理类，此类中的对象，会将符合要求的方法，直接修改执行堆栈到UI堆栈中
 */
public class AgentManager extends AbstractManager<Class<?>, Map<Object, List<Method>>> {

    private static AgentManager agentManager = new AgentManager();

    private AgentManager() {
        super();
    }

    public static AgentManager getInstance() {
        if (agentManager == null) {
            agentManager = new AgentManager();
        }
        return agentManager;
    }

    public void register(Object object, List<Method> methods) {
        Class<?> aClass = object.getClass();
        Map<Object, List<Method>> caches = new HashMap<>();
        caches.put(object, methods);
        map.put(aClass, caches);
    }
}
